using System.ComponentModel.DataAnnotations.Schema;
using System.Data.Entity.ModelConfiguration;

namespace ConsoleApplication2.Models.Mapping
{
    public class so_consolidatecustMap : EntityTypeConfiguration<so_consolidatecust>
    {
        public so_consolidatecustMap()
        {
            // Primary Key
            this.HasKey(t => new { t.sumfields, t.dimfields });

            // Properties
            this.Property(t => t.Customer__)
                .HasMaxLength(10);

            this.Property(t => t.currency)
                .HasMaxLength(5);

            this.Property(t => t.document_type)
                .HasMaxLength(16);

            this.Property(t => t.number)
                .HasMaxLength(8);

            this.Property(t => t.notes)
                .HasMaxLength(50);

            this.Property(t => t.batch)
                .HasMaxLength(8);

            this.Property(t => t.HeaderView)
                .HasMaxLength(175);

            this.Property(t => t.sumfields)
                .IsRequired()
                .HasMaxLength(15);

            this.Property(t => t.dimfields)
                .IsRequired()
                .HasMaxLength(1);

            // Table & Column Mappings
            this.ToTable("so_consolidatecust");
            this.Property(t => t.Customer__).HasColumnName("Customer_#");
            this.Property(t => t.currency).HasColumnName("currency");
            this.Property(t => t.date).HasColumnName("date");
            this.Property(t => t.document_type).HasColumnName("document_type");
            this.Property(t => t.number).HasColumnName("number");
            this.Property(t => t.notes).HasColumnName("notes");
            this.Property(t => t.amount).HasColumnName("amount");
            this.Property(t => t.base_1).HasColumnName("base_1");
            this.Property(t => t.base_2).HasColumnName("base_2");
            this.Property(t => t.document_id).HasColumnName("document_id");
            this.Property(t => t.batch).HasColumnName("batch");
            this.Property(t => t.HeaderView).HasColumnName("HeaderView");
            this.Property(t => t.sumfields).HasColumnName("sumfields");
            this.Property(t => t.dimfields).HasColumnName("dimfields");
        }
    }
}
